<template>
	<view class="page-wrap">
		<view class="flexView">
			<view class="scrollView">
				<view class="head-read">
					<view class="flex">
						<open-data class="read-img" type="userAvatarUrl"></open-data>
						<view class="flex-box">
							<view class="flex-box-text">姓名：<open-data type="userNickName"></open-data></view>
							<view class="flex-box-text" v-if="userInfo.mobile">手机号：{{ userInfo.mobile }}</view>
						</view>
						<!-- <view class="arrow arrow-one"><span>名词解释</span></view> -->
					</view>
				</view>
				<view class="white-box">
					<view class="tx">
						<view class="tx-grid">
							<view class="tx-grid-text">
								<view class="title">可提现余额</view>
								<view class="money">
									<text>{{ userInfo.integral||0 }}</text>
									<text class="money-b">元</text>
								</view>
							</view>
						</view>
						<view class="tx-grid" @click="tixina()"><span  class="tx-grid-comm-sign">立即提现</span></view>
					</view>
				</view>
				<uni-list>
					<uni-list-item v-for="(item, index) in list" :key="index" showArrow link
						:to="'/pages/order/order-desc?id='+item.order_id" :title="'回收'+item.weight+'KG'"
						:note="'收益'+item.integral+'元/积分'" :rightText="initDateTime(item.datetime)" />
				</uni-list>

				<view class="tip">仅显示近半年内的订单记录</view>
			</view>

		</view>

	</view>
</template>

<script>
	import {
		getDistances,
		dateUtils
	} from '../../common/utils.js'
	import {mapGetters} from 'vuex'
	export default {
		computed: {
			...mapGetters({
				userInfo: 'userInfo'
		   })
		},
		data() {
			return {
				list: [],
			};
		},
		onLoad() {
			this.$api("recovery-order", "getMyOrderLog").then(res => {
				this.list = res.data
			})
		},
		methods: {
			tixina(){
				uni.showModal({
					title:"提示",
					content:"可在：我的-联系客服 申请提现！"
				})
			},
			initDateTime(datetime) {
				return dateUtils.formatDateZh(new Date(datetime))
			}
		}
	};
</script>
<style lang="scss" scoped>
	.flexView {
		width: 100%;
		height: 100%;
		margin: 0 auto;
		display: flex;
		flex-direction: column;
		.scrollView {
			width: 100%;
			height: 100%;
			flex: 1;
			overflow-y: auto;
			overflow-x: hidden;
			position: relative;
			padding-bottom: 116rpx;
			.head-read {
				background: linear-gradient(to right,#36CB82, #31b977);
				background-color: #36CB82;
				padding-bottom: 100rpx;
				.flex {
					display: flex;
					align-items: center;
					padding: 50rpx;
					position: relative;
					.read-img {
						width: 120rpx;
						height: 120rpx;
						border-radius: 100%;
						overflow: hidden;
						margin-right: 20rpx;
						border: 4rpx solid rgba(255, 255, 255, 0.3);
					}
					.flex-box {
						flex: 1;
						min-width: 0;
						font-size: 26rpx;
						color: #333;
						&-text {
							margin: 10rpx 0;
							color: #f5f5f5;
							font-weight: normal;
						}
					}
					.arrow {
						position: relative;
						padding-right: 30rpx;
						span {
							font-size: 28rpx;
							color: white;
						}
						&:after {
							content: ' ';
							display: inline-block;
							height: 12rpx;
							width: 12rpx;
							border-width: 4rpx 4rpx 0 0;
							border-color: #848484;
							border-style: solid;
							transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
							position: relative;
							top: -4rpx;
							position: absolute;
							top: 50%;
							margin-top: -8rpx;
							right: 4rpx;
							border-radius: 2rpx;
						}
					}
					.arrow-one:after {
						border-color: white;
						margin-top: -6rpx;
					}
				}
			}
			.white-box {
				width: 94%;
				background: white;
				border-radius: 10rpx;
				margin: -120rpx auto 20rpx;
				box-shadow: 0 6rpx 20rpx #e7e7e7;
				.tx {
					padding-top: 26rpx;
					overflow: hidden;
					display: flex;
					justify-content: space-between;
					align-content: center;
					&-grid {
						box-sizing: border-box;
						&:first-child {
							margin-left: 40rpx;
						}
						&-comm-sign {
							display: block;
							border-radius: 40rpx 0 0 40rpx;
							font-size: 26rpx;
							padding: 16rpx 44rpx;
							background: linear-gradient(to right, #36CB82, #31b977);
							background-color: #fef082;
							color: #FFFFFF;
						}
						&-text {
							display: block;
							color: #333;
							font-size: 26rpx;
							white-space: nowrap;
							text-overflow: ellipsis;
							overflow: hidden;
							.title {
								font-size: 26rpx;
								font-weight: normal;
								color: #31b977;
							}
							.money {
								font-size: 60rpx;
								color:#31b977;
								letter-spacing: 2rpx;
								margin-bottom: 10rpx;
								&-b {
									font-size: 28rpx;
								}
							}
						}
					}
				}
				.palace {
					padding-bottom: 20rpx;
					overflow: hidden;
					display: flex;
					justify-content: center;
					&-grid {
						flex: 1;
						position: relative;
						box-sizing: border-box;
						&:not(:last-child) {
							&:after {
								width: 1rpx;
								height: 80rpx;
								background: #fddece;
								content: ' ';
								display: inline-block;
								position: absolute;
								top: 0;
								right: 0;
							}
						}
						&-text {
							display: block;
							text-align: center;
							color: #333;
							font-size: 32rpx;
							white-space: nowrap;
							text-overflow: ellipsis;
							overflow: hidden;
							&-name {
								font-size: 26rpx;
								font-weight: normal;
								color: #ff8a4a;
							}
							&-data {
								font-size: 32rpx;
								color: #ff8a4a;
								letter-spacing: 2rpx;
								margin-bottom: 5rpx;
								&-b {
									font-size: 20rpx;
								}
							}
						}
					}
				}
			}
		}
	}
	.list-view {
		position: relative;
		width: 100%;
		overflow: hidden;
	}
	
	.list-item {
		width: 100%;
		padding: 30rpx 28rpx;
		box-sizing: border-box;
		background: #fff;
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		border-bottom: 1rpx solid #eaeef1;
	}
	
	.item-last::after {
		left: 0 !important;
	}
	
	.content-box {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
	}
	
	.des-box {
		min-height: 80rpx;
		padding-left: 28rpx;
		box-sizing: border-box;
		vertical-align: top;
		color: #333;
		font-size: 24rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}
	
	.tit {
		font-size: 32rpx;
		max-width: 420rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.source {
		margin: 12rpx 0;
	}
	.time {
		color: #888;
	}
	
	.money {
		font-size: 38rpx;
		font-weight: 500;
		color: #31b977;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		padding-left: 20rpx;
	}
	
	.less {
		color: #4caf50 !important;
	}
	.tip {
		margin-top: 50rpx;
		display: flex;
		justify-content: center;
		align-content: center;
		font-size: 24rpx;
		color: #888;
	}
</style>